﻿using Admin.Application.Const;
using Framework.Core;
using Framework.Core.Cache;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Admin.Application
{
	public static class SqlSugarFilter
	{
		private static readonly CacheHelp cacheHelp = App.GetRequiredService<CacheHelp>();

		/// <summary>
		/// 删除用户机构缓存
		/// </summary>
		/// <param name="userId"></param>
		/// <param name="dbConfigId"></param>
		public static void DeleteUserOrgCache(long userId, string dbConfigId)
		{
			// 删除用户机构集合缓存
			cacheHelp.Remove($"{CacheConst.KeyUserOrg}{userId}");
			// 删除最大数据权限缓存
			cacheHelp.Remove($"{CacheConst.KeyRoleMaxDataScope}{userId}");
			// 用户权限缓存（按钮集合）
			cacheHelp.Remove($"{CacheConst.KeyUserButton}{userId}");
		}
	}
}
